import Taro, {Component, Config, getCurrentPages} from '@tarojs/taro'
import {View} from '@tarojs/components'
import {AtButton} from 'taro-ui';
import {observer, inject} from '@tarojs/mobx'
import Stores from "../../stores/storeIdentifier"
import ProductStore from '../../stores/productStore';
import CartStore from '../../stores/cartStore';
import AuthenticationStore from '../../stores/authenticationStore';
import OrderStore from '../../stores/orderStore';
import './result.scss'

export interface IResultProps {
  productStore: ProductStore,
  cartStore: CartStore,
  authenticationStore: AuthenticationStore,
  orderStore: OrderStore
}

@inject(Stores.ProductStore, Stores.AuthenticationStore, Stores.CartStore, Stores.OrderStore)
@observer
class Result extends Component<IResultProps> {
  config: Config = {
    backgroundColor: '#c80d0d',
    navigationBarTitleText: '转发'
  }
  type: any = this.$router.params.type;

  componentWillMount() {
  }

  onShareAppMessage() {

    let tmpPath = '/pages/index/share?id=' + this.$router.params.id + '&type=' + this.$router.params.type
    let shareTet = this.type == '0' ? '收下这份为你真挚挑选的礼物呗，嘿嘿':'我已经找到了原谅你的最好方式，嘿嘿';
    return {
      title: shareTet,
      path: tmpPath,
      success: function (res) {
        console.log('success')
      },
      fail: function (res) {
        console.log('fail')
      },
      complete: function () {
        console.log('complete');
      }
    }
  }

  render() {
    return (
      <View className={'share-wrap ' + (this.$router.params.type === '0' ? '' : 'beidong')}>
        <AtButton className='share-btn' openType='share' type='primary' size='normal'> </AtButton>
      </View>
    )
  }
}

export default Result
